package com.yq.day73.test1;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

/**
 * @author 3307235355@qq.com
 * @description
 * @since 2022/07/03 19:53
 */
public class Demo01 {
    public static void main(String[] args) {
        // ExecutorService ex = Executors.newCachedThreadPool();
        // ex.submit(new MyThread());
        // ex.shutdown();
        //

        ExecutorService ex2 = Executors.newSingleThreadExecutor();
        ex2.submit(new MyThread());
        ex2.submit(new MyThread());



    }
}

class MyThread implements Runnable{


    @Override
    public void run() {
        try {
            Thread.sleep(5000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        System.out.println(Thread.currentThread().getName()+"开始run！！！");
    }
}